//
//  ProfileManager.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/7/18.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit

class ProfileManager: NSObject {
    
    class func tradeStatusCoinInfoDic() -> [Int:String] {
        return [10010005:kText("平台转入"),
                10010010:kText("网络转入"),
                10010015:kText("平台转出"),
                10010020:kText("网络转出"),
                10010025:kText("账户划入"),
                10010030:kText("账户划出"),
                10010035:kText("资金冻结"),
                10010040:kText("资金解冻"),
                10010045:kText("交易买入"),
                10010050:kText("交易卖出"),
                10010055:kText("交易手续费"),
                10010060:kText("提现手续费"),
                10010065:kText("活动赠送"),
                10010070:kText("特殊扣除"),
                10010100:kText("提现冻结"),
                10010105:kText("提现解冻")]
    }
    
    class func tradeStatusLegalInfoDic() -> [Int:String] {
         return [10050005:kText("平台转入"),
                10050010:kText("平台转出"),
                10050015:kText("交易买入"),
                10050020:kText("交易卖出"),
                10050025:kText("账户划入"),
                10050030:kText("账户划出"),
                10050035:kText("资金冻结"),
                10050040:kText("资金解冻"),
                10050045:kText("交易手续费")]
    }
    
    class func tradeStatusLeverInfoDic() -> [Int:String] {
        return [10070005:kText("平台转入"),
                10070010:kText("平台转出"),
                10070015:kText("交易买入"),
                10070020:kText("交易卖出"),
                10070025:kText("账户划入"),
                10070030:kText("账户划出"),
                10070035:kText("资金冻结"),
                10070040:kText("资金解冻"),
                10070045:kText("交易手续费")]
    }
    
    class func getTransInfoWithCode(code:Int,type:CoinAccountType) -> String{
        var info:String?
        if type == .coinType {
         info = self.tradeStatusCoinInfoDic()[code]
        }else if type == .legalType{
          info = self.tradeStatusLegalInfoDic()[code]
        }else {
           info = self.tradeStatusLeverInfoDic()[code]
        }
        if info == nil {
            return ""
        }
        if info?.count == 0 {
            return ""
        }else {
            return info!
        }
    }
    
    class func getCodeWithTransInfo(name:String,type:CoinAccountType) -> Int? {
        var info:[Int:String] = [:]
        if type == .coinType {
            info = self.tradeStatusCoinInfoDic()
        }else if type == .legalType{
            info = self.tradeStatusLegalInfoDic()
        }else {
            info = self.tradeStatusLeverInfoDic()
        }
        let keys = Array(info.keys)
        for (_,key) in keys.enumerated() {
            let data = info[key]
            if data == name {
                return key
            }
        }
        return nil
    }
    
    

}
